import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Layout from "../layout/index.vue";

const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        name: "Layout",
        component: Layout,
        redirect: "/welcome",
        children: [
            {
                path: "welcome",
                name: "Welcome",
                component: () => import("../views/welcome-page.vue"),
            },
            {
                path: "musics",
                name: "Musics",
                component: () => import("../views/music-list.vue"),
            },
            {
                path: "favorite",
                name: "Favorite",
                component: () => import("../views/favorite-music.vue"),
            },
            {
                path: "artist",
                name: "Artist",
                component: () => import("../views/artist-list.vue"),
            },
            {
                path: "album",
                name: "Album",
                component: () => import("../views/album-list.vue"),
            },
            {
                path: "recent",
                name: "RecentMusic",
                component: () => import("../views/recent-music.vue"),
            },
            {
                path: "playlist/:id",
                name: "PlayList",
                component: () => import("../views/playlist.vue"),
            },
            {
                path: "manage",
                name: "MusicManage",
                component: () => import("../views/music-manage.vue"),
            },
            {
                path: "search",
                name: "Search",
                component: () => import("../views/search-result.vue"),
            },
        ],
    },
    {
        path: "/test",
        name: "Test",
        component: () => import("../test/index.vue"),
    },
    {
        path: "/login",
        name: "Login",
        component: () => import("../views/login.vue"),
    },
];

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
});

export default router;
